home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume14 / unzip-3.1 / part02 < prev    next >
Encoding:
Text File  |  1990-09-20  |  49.3 KB  |  1,770 lines

  1. Newsgroups: comp.sources.misc
  2. From: kirsch@usasoc.soc.mil (David Kirschbaum)
  3. Subject: v14i105: Portable UnZIP 3.1 (part 2 of 3)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 105
  7. Submitted-by: kirsch@usasoc.soc.mil (David Kirschbaum)
  8. Archive-name: unzip-3.1/part02
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 2 (of 3)."
  17. # Contents:  Makefile file_io.c unimplod.c unzip.h unzip.os2
  18. # Wrapped by kirsch@usasoc.soc.mil on Fri Aug 31 11:37:51 1990
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'Makefile'\"
  22. else
  23. echo shar: Extracting \"'Makefile'\" \(7578 characters\)
  24. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  25. X# Makefile for unzip
  26. X# v3.07+ Added Amdahl (IBM) mainframe
  27. X#     Removed casual suggestion to define NOTINT16 if in doubt.
  28. X#     Turns out we can't be all THAT casual about it!    
  29. X# v3.07+ Added IBM RT 6150 under AIX 2.2.1
  30. X# v3.06+ Changed "make sun4_110" back to "make sun4" (to match SYSTEMS list
  31. X#     and since we don't have any other sun4 arguments yet).
  32. X# v3.06+ Added VAX 8600/Ultrix, DEC 5820/Ultrix test v4.0
  33. X# v3.05 And better yet, thanks to Bill Davidsen's fixes.
  34. X# v3.04 A better way for multiple systems, thanks to Warner Losh and
  35. X#    Bill Davidsen.
  36. X# foo1:    common
  37. X# foo2: common
  38. X# common: $(MAKE) unzip whateverflags...
  39. X#
  40. X#    Nice .. makes sense .. however don't work worth beans on my vaxbsd
  41. X#    system!  ("Don't know how to make make" or some such)
  42. X#    Added Silicon Graphics system, thanks to 
  43. X#    root%itnsg1.cineca.it@CUNYVM.CUNY.EDU (Root (Valter Cavecchia))
  44. X#
  45. X# v3.0    Added HP-UX
  46. X#    Consolidated some system makerules
  47. X# ******** INSTRUCTIONS (such as they are) ********
  48. X#
  49. X# "make vaxbsd" -- makes unzip on a VAX 11-780 BSD 4.3 in current directory
  50. X# "make"    -- uses environment variable SYSTEM to set the type
  51. X#           system to compile for.
  52. X# "make wombat" -- Chokes and dies if you haven't added the specifics
  53. X#           for your Wombat 68000 (or whatever) to the systems list.
  54. X#
  55. X# CFLAGS are flags for the C compiler.  LDFLAGS are flags for the loader.
  56. X#
  57. X# My host (a VAX 11-780 running BSD 4.3) is hereafter referred to as
  58. X# "my host."
  59. X#
  60. X# My host's /usr/include/sys/param.h defines BSD for me.
  61. X# You may have to add "-DBSD" to the list of CFLAGS for your system.
  62. X#
  63. X# You MAY need to define "-DNOTINT16" if the program produces crc errors
  64. X# during a "-t" run or extraction.  (This involves structure alignment.)
  65. X#
  66. X# If your host is "big-endian" (as in the 68000 family) and does NOT order
  67. X# its integers and long integers in Intel fashion (low .. high), you should
  68. X# define "-DHIGH_LOW".  This insures key structure values will be "swapped"
  69. X# low end for high end.
  70. X# Some mainframes DO require this.
  71. X#
  72. X# Some systems have a shell-defined "$MAKE" (my host did not).  If not,
  73. X# use "make" instead of the "$MAKE" or "$(MAKE)" in your system's makerule.
  74. X# Or try adding the following line to your .login file:
  75. X#   setenv MAKE "make"
  76. X# (It didn't help on my host.)
  77. X#
  78. X# zmemcpy has been added to the list of required files for some systems.
  79. X# memcpy() is a normal C function that works just fine in Turbo C
  80. X# and some Unix systems, but has a problem in others (producing CRC errors).
  81. X#
  82. X# You can try a compile without zmemcpy.c, and if it works .. fine.
  83. X# (To do this, you may have to remove zmemcpy.o from your system's list
  84. X# of required OBJS files, and the "-DZMEM" from the list of CFLAGS defines.)
  85. X#
  86. X# Else use the included zmemcpy.c.
  87. X# (Again, you may have to add zmemcpy.o to your system's list of required
  88. X# OBJS files, and the "-DZMEM" to the list of CFLAGS defines.)
  89. X
  90. X# To test your nice new unzip, insure your zip file includes some LARGE
  91. X# members.  Many systems ran just fine with zip file members <512 bytes,
  92. X# but failed with larger ones.
  93. X#
  94. X
  95. X# Defaults most systems use
  96. XCFLAGS = -O -DUNIX
  97. X
  98. XCC=cc
  99. X
  100. XSHELL = /bin/sh
  101. X
  102. X.c.o :
  103. X    $(CC) -c $(CFLAGS) $*.c
  104. X
  105. X# Defaults everybody uses
  106. XOBJS = unzip.o crc32.o match.o ascebc.o mapname.o
  107. XSRCS = unzip.c crc32.c match.c ascebc.c mapname.c
  108. X
  109. X# You'll need these also if you include "-DZMEM" in your CFLAGS
  110. XZMEMS = zmemset.o zmemcpy.o
  111. X
  112. X# list of supported systems in this version
  113. XSYSTEMS    =xenix386 ultrix sun3 sun4 encore stellar convex\
  114. X    vaxbsd next vaxsysV hp_ux pyramid sgi diab\
  115. X    dec5820 vax8600 rtaix amdahl
  116. X
  117. X# The below will try to use your shell variable "SYSTEM"
  118. X# as the type system to use (e.g., if you command:
  119. X# make <no parameters>
  120. X# at the command line).
  121. X
  122. Xdefault:
  123. X    if test -z "$(SYSTEM)";\
  124. X    then make ERROR;\
  125. X    else make $(SYSTEM);\
  126. X    fi
  127. X
  128. XERROR:
  129. X    @echo "Must make one of $(SYSTEMS)"
  130. X    @echo "or set shell variable SYSTEM to a legal value"
  131. X
  132. Xunzip: $(OBJS)
  133. X    cc $(LDFLAGS) -o unzip $(OBJS)
  134. X
  135. Xunzip.o: unzip.c
  136. X
  137. Xcrc32.o: crc32.c
  138. X
  139. Xmatch.o: match.c
  140. X
  141. Xascebc.o: ascebc.c
  142. X
  143. Xzmemcpy.o: zmemcpy.c
  144. X
  145. Xzmemset.o: zmemset.c
  146. X
  147. Xmapname.o: mapname.c
  148. X#
  149. X# these are the makerules for various systems
  150. X# TABS ARE REQUIRED FOR SOME VERSIONS OF make!
  151. X# DO NOT DE-TABIFY THIS FILE!
  152. X# Example:
  153. X# wombat:^I# wombat 68000
  154. X#        ^this is an ASCII 9 tab char, NOT a bunch of spaces!
  155. X#^I$(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM" \
  156. X#^IOBJS="$(OBJS) $(ZMEMS)"
  157. X#^these indentations are an ASCII 9 tab char!
  158. X
  159. X# ********
  160. Xxenix386:    _zmem    # Xenix/386 (tested on 2.3.1)
  161. XvaxsysV:    _zmem    # from Forrest Gehrke
  162. Xencore:        _zmem    # Multimax
  163. X_zmem:
  164. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DZMEM" \
  165. X    OBJS="$(OBJS) $(ZMEMS)"
  166. X
  167. X# ********
  168. Xconvex:        _16zmem    # C200/C400
  169. Xstellar:    _16zmem    # gs-2000
  170. Xsun4:        _16zmem    # Sun 4/110, SunOS 4.0.3c
  171. Xhp_ux:        _16zmem    # HP 9000-835 SE, HP-UX Release A.B3.10 Ver D
  172. X            # Thanks to Randy McCaskile,
  173. X            # rmccask@seas.gwu.edu
  174. Xdec5820:    _16zmem    # DEC 5820 (RISC), Test version of Ultrix v4.0
  175. X            # thanks to "Moby" Dick O'Connor 
  176. Xrtaix:        _16zmem    # IBM RT 6150 under AIX 2.2.1
  177. X            # thanks to Erik-Jan Vens
  178. X
  179. X_16zmem:
  180. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16 -DZMEM" \
  181. X    OBJS="$(OBJS) $(ZMEMS)"
  182. X
  183. X# ********
  184. Xdiab:        _mc68k  # 680X0, DIAB dnix 5.2/5.3 (a Swedish System V clone)
  185. Xsun3:        _mc68k  # 68020, SunOS 4.0.3
  186. Xamdahl:        _mc68k    # Amdahl (IBM) mainframe, UTS (SysV) 1.2.4 and 2.0.1
  187. X            # thanks to Kim DeVaughn via Greg Roelofs (Cave Newt)
  188. X            # <roelofs@amelia.nas.nasa.gov>
  189. X_mc68k:
  190. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DHIGH_LOW -DZMEM" \
  191. X    OBJS="$(OBJS) $(ZMEMS)"
  192. X
  193. X# Toad Hall:  My Vax doesn't know anything about "$(MAKE)".
  194. X# I tried adding 'setenv MAKE "make" to my .login
  195. X# but it still wouldn't.  Unix wizards, to the rescue!
  196. X# v3.04 and the new flashy common system fix don't work on my vax either!
  197. X# Well .. maybe it will for the Ultrix system and others.
  198. X
  199. Xultrix: _defaults    # per Greg Flint
  200. Xvax8600: _defaults    # also for VAX8600 w/Ultrix OS
  201. X            # per Jim Steiner, steiner@pica.army.mil
  202. Xvaxbsd:    _defaults    # VAX 11-780, BSD 4.3    David Kirschbaum
  203. X_defaults:
  204. X    make unzip
  205. X
  206. X#From Mark Adler, madler@tybalt.caltech.edu:
  207. X#  I used "make stellar" on the NeXT and the resulting unzip
  208. X#  worked fine on all my zip test files.  Not willing to leave
  209. X#  well enough alone, I tried it without the zmem* routines by
  210. X#  adding the following to the Makefile:
  211. X
  212. Xnext:        # 68030 BSD 4.3+Mach
  213. X    $(MAKE) unzip CFLAGS="$(CFLAGS) -DNOTINT16" \
  214. X    OBJS="$(OBJS)"
  215. X
  216. X#  and using "make next".  This also worked fine, and presumably
  217. X#  is faster since the native memcpy and memset routines are
  218. X#  optimized assembler.
  219. X# ***
  220. X#I have finished porting unzip 3.0 to the Pyramid 90X under OSX4.1.
  221. X#The biggest problem was the default structure alignment yielding two
  222. X#extra bytes.  The compiler has the -q option to pack structures, and
  223. X#this was all that was needed.  So, I changed the Makefile, adding "pyramid"
  224. X#to the SYSTEMS list, and inserting the following lines:
  225. X#James Dugal, Internet: jpd@usl.edu
  226. X
  227. Xpyramid:    # Pyramid 90X, probably all, under >= OSx4.1, BSD universe
  228. X    make unzip CFLAGS="$(CFLAGS) -q -DBSD -DNOTINT16 -DZMEM" \
  229. X    OBJS="$(OBJS) $(ZMEMS)"
  230. X
  231. X#I successfully compiled and tested the unzip program (v30) for the
  232. X#Silicon Graphics environment (Personal Iris 4D20/G with IRIX v3.2.2)
  233. X#
  234. X#  Valter V. Cavecchia          | Bitnet:       cavecchi@itncisca
  235. X#  Centro di Fisica del C.N.R.  | Internet:     root@itnsg1.cineca.it
  236. X#  I-38050 Povo (TN) - Italy    | Decnet:       itnvax::cavecchia (37.65)
  237. X
  238. Xsgi:        # Silicon Graphics (tested on Personal Iris 4D20)
  239. X    $(MAKE) unzip \
  240. X    CFLAGS="$(CFLAGS) -I/usr/include/bsd -DZMEM -DBSD -DNOTINT16" \
  241. X    OBJS="$(OBJS) $(ZMEMS)" \
  242. X    LDFLAGS="-lbsd"
  243. END_OF_FILE
  244. if test 7578 -ne `wc -c <'Makefile'`; then
  245.     echo shar: \"'Makefile'\" unpacked with wrong size!
  246. fi
  247. # end of 'Makefile'
  248. fi
  249. if test -f 'file_io.c' -a "${1}" != "-c" ; then 
  250.   echo shar: Will not clobber existing file \"'file_io.c'\"
  251. else
  252. echo shar: Extracting \"'file_io.c'\" \(9601 characters\)
  253. sed "s/^X//" >'file_io.c' <<'END_OF_FILE'
  254. X/* v3.05 File related functions for unzip.c */
  255. X
  256. X/*
  257. X * input file variables
  258. X *
  259. X */
  260. X
  261. X#define INBUFSIZ BUFSIZ     /* same as stdio uses */
  262. Xbyte *inbuf;            /* input file buffer - any size is legal */
  263. Xbyte *inptr;
  264. X
  265. Xint incnt;
  266. XUWORD bitbuf;
  267. Xint bits_left;
  268. Xboolean zipeof;
  269. X
  270. Xint zipfd;
  271. Xchar zipfn[STRSIZ];
  272. Xlocal_file_header lrec;
  273. X
  274. X/* ----------------------------------------------------------- */
  275. X/*
  276. X * output stream variables
  277. X *
  278. X */
  279. X
  280. X#define OUTBUFSIZ 0x2000        /* unImplode needs power of 2, >= 0x2000 */
  281. Xbyte *outbuf;                   /* buffer for rle look-back */
  282. Xbyte *outptr;
  283. Xbyte *outout;                 /* Scratch pad for ascebc trans v2.0g */
  284. X
  285. Xlongint outpos;         /* absolute position in outfile */
  286. Xint outcnt;             /* current position in outbuf */
  287. X
  288. Xint outfd;
  289. Xchar filename[STRSIZ];
  290. Xchar extra[STRSIZ];
  291. Xchar comment[STRSIZ];       /* v2.0b made it global for displays */
  292. X
  293. X
  294. Xvoid set_file_time()
  295. X /*
  296. X  * set the output file date/time stamp according to information from the
  297. X  * zipfile directory record for this file
  298. X  */
  299. X{
  300. X#ifndef UNIX
  301. X    union {
  302. X        struct ftime ft;        /* system file time record */
  303. X        struct {
  304. X                UWORD ztime;     /* date and time words */
  305. X                UWORD zdate;     /* .. same format as in .ZIP file */
  306. X        } zt;
  307. X    } td;
  308. X
  309. X    /*
  310. X     * set output file date and time - this is optional and can be
  311. X     * deleted if your compiler does not easily support setftime()
  312. X     */
  313. X
  314. X    td.zt.ztime = lrec.last_mod_file_time;
  315. X    td.zt.zdate = lrec.last_mod_file_date;
  316. X
  317. X    setftime(outfd, &td.ft);
  318. X
  319. X#else   /* UNIX */
  320. X
  321. X    time_t times[2];
  322. X    struct tm *tmbuf;
  323. X    long m_time;
  324. X    int yr, mo, dy, hh, mm, ss, leap, days = 0;
  325. X#ifdef BSD
  326. X    struct timeval tv;
  327. X    struct timezone tz;
  328. X#endif
  329. X
  330. X    /*
  331. X     * These date conversions look a little wierd, so I'll explain.
  332. X     * UNIX bases all file modification times on the number of seconds
  333. X     * elapsed since Jan 1, 1970, 00:00:00 GMT.  Therefore, to maintain
  334. X     * compatibility with MS-DOS archives, which date from Jan 1, 1980,
  335. X     * with NO relation to GMT, the following conversions must be made:
  336. X     *      the Year (yr) must be incremented by 10;
  337. X     *      the Date (dy) must be decremented by 1;
  338. X     *      and the whole mess must be adjusted by TWO factors:
  339. X     *          relationship to GMT (ie.,Pacific Time adds 8 hrs.),
  340. X     *          and whether or not it is Daylight Savings Time.
  341. X     * Also, the usual conversions must take place to account for leap years,
  342. X     * etc.
  343. X     *                                     C. Seaman
  344. X     */
  345. X
  346. X    yr = (((lrec.last_mod_file_date >> 9) & 0x7f) + 10);  /* dissect date */
  347. X    mo = ((lrec.last_mod_file_date >> 5) & 0x0f);
  348. X    dy = ((lrec.last_mod_file_date & 0x1f) - 1);
  349. X
  350. X    hh = ((lrec.last_mod_file_time >> 11) & 0x1f);        /* dissect time */
  351. X    mm = ((lrec.last_mod_file_time >> 5) & 0x3f);
  352. X    ss = ((lrec.last_mod_file_time & 0x1f) * 2);
  353. X
  354. X    /* leap = # of leap years from 1970 up to but not including
  355. X       the current year */
  356. X
  357. X    leap = ((yr+1969)/4);              /* Leap year base factor */
  358. X
  359. X    /* How many days from 1970 to this year? */
  360. X    days = (yr * 365) + (leap - 492);
  361. X
  362. X    switch(mo)                 /* calculate expired days this year */
  363. X    {
  364. X    case 12:
  365. X        days += 30;
  366. X    case 11:
  367. X        days += 31;
  368. X    case 10:
  369. X        days += 30;
  370. X    case 9:
  371. X        days += 31;
  372. X    case 8:
  373. X        days += 31;
  374. X    case 7:
  375. X        days += 30;
  376. X    case 6:
  377. X        days += 31;
  378. X    case 5:
  379. X        days += 30;
  380. X    case 4:
  381. X        days += 31;
  382. X    case 3:
  383. X        days += 28;                    /* account for leap years */
  384. X        if (((yr+1970) % 4 == 0) && (yr+1970) != 2000)
  385. X            ++days;
  386. X    case 2:
  387. X        days += 31;
  388. X    }
  389. X
  390. X    /* convert date & time to seconds relative to 00:00:00, 01/01/1970 */
  391. X    m_time = ((days + dy) * 86400) + (hh * 3600) + (mm * 60) + ss;
  392. X
  393. X#ifdef BSD
  394. X    gettimeofday(&tv, &tz);
  395. X/* This program is TOO smart about daylight savings time.
  396. X * Adjusting for it throws our file times off by one hour if it's true.
  397. X * Remming it out.
  398. X *
  399. X *  if (tz.tz_dsttime != 0)
  400. X *      m_time -= 3600;
  401. X */
  402. X    m_time += tz.tz_minuteswest * 60;  /* account for timezone differences */
  403. X#else   /* !BSD */
  404. X    tmbuf = localtime(&m_time);
  405. X    hh = tmbuf->tm_hour;
  406. X    tmbuf = gmtime(&m_time);
  407. X    hh = tmbuf->tm_hour - hh;
  408. X    if (hh < 0)
  409. X    hh += 24;
  410. X    m_time += (hh * 3600);             /* account for timezone differences */
  411. X#endif
  412. X
  413. X    times[0] = m_time;             /* set the stamp on the file */
  414. X    times[1] = m_time;
  415. X    utime(filename, times);
  416. X#endif  /* UNIX */
  417. X}
  418. X
  419. X
  420. Xint create_output_file()
  421. X /* return non-0 if creat failed */
  422. X{   /* create the output file with READ and WRITE permissions */
  423. X    static int do_all = 0;
  424. X    char answerbuf[10];
  425. X    UWORD holder;
  426. X
  427. X    if (cflag) {        /* output to stdout (a copy of it, really) */
  428. X        outfd = dup(1);
  429. X        return 0;
  430. X        }
  431. X    CR_flag = 0;    /* Hack to get CR at end of buffer working. */
  432. X
  433. X    /* 
  434. X     * check if the file exists, unless do_all 
  435. X     * ask before overwrite code by Bill Davidsen (davidsen@crdos1.crd.ge.com)
  436. X     */
  437. X    if (!do_all) {
  438. X        outfd = open(filename, 0);
  439. X    if (outfd >= 0) {
  440. X        /* first close it, before you forget! */
  441. X        close(outfd);
  442. X
  443. X        /* ask the user before blowing it away */
  444. X        fprintf(stderr, "replace %s, y-yes, n-no, a-all: ", filename);
  445. X        fgets(answerbuf, 9, stdin);
  446. X
  447. X        switch (answerbuf[0]) {
  448. X          case 'y':
  449. X          case 'Y':
  450. X            break;
  451. X          case 'a':
  452. X          case 'A':
  453. X            do_all = 1;
  454. X        break;
  455. X          case 'n':
  456. X          case 'N':
  457. X          default:
  458. X            while(ReadByte(&holder));
  459. X        return 1; /* it's done! */
  460. X        }
  461. X    }
  462. X    }
  463. X
  464. X#ifndef UNIX
  465. X    outfd = creat(filename, S_IWRITE | S_IREAD);
  466. X#else
  467. X    outfd = creat(filename, 0666);  /* let umask strip unwanted perm's */
  468. X#endif
  469. X
  470. X    if (outfd < 1) {
  471. X        fprintf(stderr, "Can't create output: %s\n", filename);
  472. X        return 1;
  473. X    }
  474. X
  475. X    /*
  476. X     * close the newly created file and reopen it in BINARY mode to
  477. X     * disable all CR/LF translations
  478. X     */
  479. X#ifndef UNIX
  480. X    close(outfd);
  481. X    outfd = open(filename, O_RDWR | O_BINARY);
  482. X#endif
  483. X    return 0;
  484. X}
  485. X
  486. X
  487. Xint open_input_file()
  488. X /* return non-0 if open failed */
  489. X{
  490. X    /*
  491. X     * open the zipfile for reading and in BINARY mode to prevent cr/lf
  492. X     * translation, which would corrupt the bitstreams
  493. X     */
  494. X
  495. X#ifndef UNIX
  496. X    zipfd = open(zipfn, O_RDONLY | O_BINARY);
  497. X#else
  498. X    zipfd = open(zipfn, O_RDONLY);
  499. X#endif
  500. X    if (zipfd < 1) {
  501. X        fprintf(stderr, "Can't open input file: %s\n", zipfn);
  502. X        return (1);
  503. X    }
  504. X    return 0;
  505. X}
  506. X
  507. X/* ============================================================= */
  508. X
  509. Xint readbuf(fd, buf, size)
  510. Xint fd;
  511. Xchar *buf;
  512. Xregister unsigned size;
  513. X{
  514. X    register int count;
  515. X    int n;
  516. X
  517. X    n = size;
  518. X    while (size)  {
  519. X        if (incnt == 0)  {
  520. X            if ((incnt = read(fd, inbuf, INBUFSIZ)) <= 0)
  521. X                return(incnt);
  522. X            inptr = inbuf;
  523. X        }
  524. X        count = min(size, incnt);
  525. X        zmemcpy(buf, inptr, count);
  526. X        buf += count;
  527. X        inptr += count;
  528. X        incnt -= count;
  529. X        size -= count;
  530. X    }
  531. X    return(n);
  532. X}
  533. X
  534. Xint ReadByte(x)
  535. XUWORD *x;
  536. X /* read a byte; return 8 if byte available, 0 if not */
  537. X{
  538. X    if (csize-- <= 0)
  539. X        return 0;
  540. X    if (incnt == 0)  {
  541. X        if ((incnt = read(zipfd, inbuf, INBUFSIZ)) <= 0)
  542. X            return 0;
  543. X        inptr = inbuf;
  544. X    }
  545. X    *x = *inptr++;
  546. X    --incnt;
  547. X    return 8;
  548. X}
  549. X
  550. X
  551. X/* ------------------------------------------------------------- */
  552. Xstatic UWORD mask_bits[] =
  553. X        {0,     0x0001, 0x0003, 0x0007, 0x000f,
  554. X                0x001f, 0x003f, 0x007f, 0x00ff,
  555. X                0x01ff, 0x03ff, 0x07ff, 0x0fff,
  556. X                0x1fff, 0x3fff, 0x7fff, 0xffff
  557. X        };
  558. X
  559. X
  560. Xint FillBitBuffer(bits)
  561. Xregister int bits;
  562. X{
  563. X    /* get the bits that are left and read the next UWORD */
  564. X        register int result = bitbuf;
  565. X    UWORD temp;
  566. X    int sbits = bits_left;
  567. X    bits -= bits_left;
  568. X
  569. X    /* read next UWORD of input */
  570. X    bits_left = ReadByte(&bitbuf);
  571. X    bits_left += ReadByte(&temp);
  572. X
  573. X    bitbuf |= (temp << 8);
  574. X    if (bits_left == 0)
  575. X        zipeof = 1;
  576. X
  577. X    /* get the remaining bits */
  578. X        result = result | (int) ((bitbuf & mask_bits[bits]) << sbits);
  579. X        bitbuf >>= bits;
  580. X        bits_left -= bits;
  581. X        return result;
  582. X}
  583. X
  584. X/* ------------------------------------------------------------- */
  585. X
  586. Xint dos2unix (buf, len)
  587. Xunsigned char *buf;
  588. Xint len;
  589. X{
  590. X    int new_len;
  591. X    int i;
  592. X    unsigned char *walker;
  593. X
  594. X    new_len = len;
  595. X    walker = outout;
  596. X    if (CR_flag && *buf != LF)
  597. X        *walker++ = ascii_to_native(CR);
  598. X    CR_flag = buf[len - 1] == CR;
  599. X    for (i = 0; i < len; i += 1) {
  600. X        *walker++ = *buf;
  601. X        if (*buf++ == CR && *buf == LF) {
  602. X            new_len--;
  603. X            walker[-1] = ascii_to_native(*buf++);
  604. X            i++;
  605. X        }
  606. X    }
  607. X    /*
  608. X     * If the last character is a CR, then "ignore it" for now...
  609. X     */
  610. X    if (walker[-1] == CR)
  611. X        new_len--;
  612. X    return new_len;
  613. X}
  614. X
  615. Xvoid WriteBuffer(fd, buf, len)
  616. Xint fd;
  617. Xunsigned char *buf;
  618. Xint len;
  619. X{
  620. X     if (aflag)
  621. X         len = dos2unix (buf, len);
  622. X     if (write (fd, outout, len) != len) {
  623. X         fprintf (stderr, "Fatal write error.\n");
  624. X         exit (1);
  625. X     }
  626. X}
  627. X
  628. X
  629. X/* ------------------------------------------------------------- */
  630. X
  631. Xvoid FlushOutput()
  632. X /* flush contents of output buffer */
  633. X{
  634. X    if (outcnt) {
  635. X        UpdateCRC(outbuf, outcnt);
  636. X
  637. X        if (!tflag)
  638. X            WriteBuffer(outfd, outbuf, outcnt);
  639. X
  640. X        outpos += outcnt;
  641. X        outcnt = 0;
  642. X        outptr = outbuf;
  643. X    }
  644. X}
  645. X
  646. END_OF_FILE
  647. if test 9601 -ne `wc -c <'file_io.c'`; then
  648.     echo shar: \"'file_io.c'\" unpacked with wrong size!
  649. fi
  650. # end of 'file_io.c'
  651. fi
  652. if test -f 'unimplod.c' -a "${1}" != "-c" ; then 
  653.   echo shar: Will not clobber existing file \"'unimplod.c'\"
  654. else
  655. echo shar: Extracting \"'unimplod.c'\" \(8228 characters\)
  656. sed "s/^X//" >'unimplod.c' <<'END_OF_FILE'
  657. X/* ------------------------------------------------------------- */
  658. X/*
  659. X * Imploding
  660. X * ---------
  661. X *
  662. X * The Imploding algorithm is actually a combination of two distinct
  663. X * algorithms.  The first algorithm compresses repeated byte sequences
  664. X * using a sliding dictionary.  The second algorithm is used to compress
  665. X * the encoding of the sliding dictionary ouput, using multiple
  666. X * Shannon-Fano trees.
  667. X *
  668. X */
  669. X
  670. X#define LITVALS     256
  671. X#define DISTVALS    64
  672. X#define LENVALS     64
  673. X#define MAXSF       LITVALS
  674. X
  675. X   typedef struct sf_entry {
  676. X       byte         Value;
  677. X       byte         BitLength;
  678. X   } sf_entry;
  679. X
  680. X   typedef struct sf_tree {   /* a shannon-fano "tree" (table) */
  681. X      sf_entry     entry[MAXSF];
  682. X      int          entries;
  683. X      int          MaxLength;
  684. X   } sf_tree;
  685. X
  686. X   typedef sf_tree      *sf_treep;
  687. X
  688. X   typedef struct sf_node {   /* node in a true shannon-fano tree */
  689. X      UWORD         left;      /* 0 means leaf node */
  690. X      UWORD         right;     /* or value if leaf node */
  691. X   } sf_node;
  692. X
  693. X   sf_tree  lit_tree;
  694. X   sf_tree  length_tree;
  695. X   sf_tree  distance_tree;
  696. X   /* s-f storage is shared with that used by other comp. methods */
  697. X   sf_node  *lit_nodes = (sf_node *) followers;     /* 2*LITVALS nodes */
  698. X   sf_node  *length_nodes = (sf_node *) suffix_of;  /* 2*LENVALS nodes */
  699. X   sf_node  *distance_nodes = (sf_node *) stack;    /* 2*DISTVALS nodes */
  700. X   boolean  lit_tree_present;
  701. X   boolean  eightK_dictionary;
  702. X   int      minimum_match_length;
  703. X   int      dict_bits;
  704. X
  705. X#ifdef __TURBOC__
  706. X/* v2.0b More local prototypes */
  707. Xvoid ReadLengths(sf_tree *tree);
  708. Xvoid SortLengths(sf_tree *tree);
  709. Xvoid GenerateTrees(sf_tree *tree, sf_node *nodes);
  710. Xvoid LoadTree(sf_tree *tree, int treesize, sf_node *nodes);
  711. Xvoid LoadTrees(void);
  712. Xvoid ReadTree(register sf_node *nodes, int *dest);
  713. X#endif
  714. X
  715. Xvoid         SortLengths(tree)
  716. Xsf_tree *tree;
  717. X  /* Sort the Bit Lengths in ascending order, while retaining the order
  718. X    of the original lengths stored in the file */
  719. X{
  720. X    register sf_entry *ejm1;    /* entry[j - 1] */
  721. X    register int j;
  722. X    register sf_entry *entry;
  723. X    register int i;
  724. X    sf_entry tmp;
  725. X    int entries;
  726. X    unsigned a, b;
  727. X
  728. X    entry = &tree->entry[0];
  729. X    entries = tree->entries;
  730. X
  731. X    for (i = 0; ++i < entries; )  {
  732. X        tmp = entry[i];
  733. X        b = tmp.BitLength;
  734. X        j = i;
  735. X        while ((j > 0)
  736. X        && ((a = (ejm1 = &entry[j - 1])->BitLength) >= b))  {
  737. X            if ((a == b) && (ejm1->Value <= tmp.Value))
  738. X                break;
  739. X            *(ejm1 + 1) = *ejm1;    /* entry[j] = entry[j - 1] */
  740. X            --j;
  741. X        }
  742. X        entry[j] = tmp;
  743. X    }
  744. X}
  745. X
  746. X
  747. X/* ----------------------------------------------------------- */
  748. X
  749. Xvoid         ReadLengths(tree)
  750. Xsf_tree *tree;
  751. X{
  752. X   int    treeBytes;
  753. X   int    i;
  754. X   int    num, len;
  755. X
  756. X  /* get number of bytes in compressed tree */
  757. X   READBIT(8,treeBytes);
  758. X   treeBytes++;
  759. X   i = 0;
  760. X
  761. X   tree->MaxLength = 0;
  762. X
  763. X/* High 4 bits: Number of values at this bit length + 1. (1 - 16)
  764. X * Low  4 bits: Bit Length needed to represent value + 1. (1 - 16)
  765. X */
  766. X   while (treeBytes > 0) {
  767. X      READBIT(4,len); len++;
  768. X      READBIT(4,num); num++;
  769. X
  770. X      while (num > 0) {
  771. X         if (len > tree->MaxLength)
  772. X            tree->MaxLength = len;
  773. X         tree->entry[i].BitLength = len;
  774. X         tree->entry[i].Value = i;
  775. X         i++;
  776. X         num--;
  777. X      }
  778. X
  779. X      treeBytes--;
  780. X   }
  781. X}
  782. X
  783. X
  784. X/* ----------------------------------------------------------- */
  785. X
  786. Xvoid         GenerateTrees(tree, nodes)
  787. Xsf_tree *tree;
  788. Xsf_node *nodes;
  789. X     /* Generate the Shannon-Fano trees */
  790. X{
  791. X    int codelen, i, j, lvlstart, next, parents;
  792. X
  793. X    i = tree->entries - 1;          /* either 255 or 63 */
  794. X    lvlstart = next = 1;
  795. X
  796. X    /* believe it or not, there may be a 1-bit code */
  797. X
  798. X    for (codelen = tree->MaxLength; codelen >= 1; --codelen)  {
  799. X
  800. X        /* create leaf nodes at level <codelen> */
  801. X
  802. X        while ((i >= 0) && (tree->entry[i].BitLength == codelen))  {
  803. X            nodes[next].left = 0;
  804. X            nodes[next].right = tree->entry[i].Value;
  805. X            ++next;
  806. X            --i;
  807. X        }
  808. X
  809. X        /* create parent nodes for all nodes at level <codelen>,
  810. X           but don't create the root node here */
  811. X
  812. X        parents = next;
  813. X        if (codelen > 1)  {
  814. X            for (j = lvlstart; j <= parents-2; j += 2)  {
  815. X                nodes[next].left = j;
  816. X                nodes[next].right = j + 1;
  817. X                ++next;
  818. X            }
  819. X        }
  820. X        lvlstart = parents;
  821. X    }
  822. X
  823. X    /* create root node */
  824. X
  825. X    nodes[0].left = next - 2;
  826. X    nodes[0].right = next - 1;
  827. X}
  828. X
  829. X
  830. X/* ----------------------------------------------------------- */
  831. X
  832. Xvoid         LoadTree(tree, treesize, nodes)
  833. Xsf_tree *tree;
  834. Xint treesize;
  835. Xsf_node *nodes;
  836. X     /* allocate and load a shannon-fano tree from the compressed file */
  837. X{
  838. X   tree->entries = treesize;
  839. X   ReadLengths(tree);
  840. X   SortLengths(tree);
  841. X   GenerateTrees(tree, nodes);
  842. X}
  843. X
  844. X
  845. X/* ----------------------------------------------------------- */
  846. X
  847. Xvoid         LoadTrees()
  848. X{
  849. X   eightK_dictionary = (lrec.general_purpose_bit_flag & 0x02) != 0; /* bit 1 */
  850. X   lit_tree_present = (lrec.general_purpose_bit_flag & 0x04) != 0;  /* bit 2 */
  851. X
  852. X   if (eightK_dictionary)
  853. X      dict_bits = 7;
  854. X   else
  855. X      dict_bits = 6;
  856. X
  857. X   if (lit_tree_present) {
  858. X      minimum_match_length = 3;
  859. X      LoadTree(&lit_tree,256,lit_nodes);
  860. X   }
  861. X   else
  862. X      minimum_match_length = 2;
  863. X
  864. X   LoadTree(&length_tree,64,length_nodes);
  865. X   LoadTree(&distance_tree,64,distance_nodes);
  866. X}
  867. X
  868. X
  869. X/* ----------------------------------------------------------- */
  870. X
  871. X#ifndef ASM
  872. X
  873. Xvoid         ReadTree(nodes, dest)
  874. Xregister sf_node *nodes;
  875. Xint *dest;
  876. X     /* read next byte using a shannon-fano tree */
  877. X{
  878. X    register int cur;
  879. X    register int left;
  880. X    UWORD b;
  881. X
  882. X    for (cur = 0; ; )  {
  883. X        if ((left = nodes[cur].left) == 0)  {
  884. X            *dest = nodes[cur].right;
  885. X            return;
  886. X        }
  887. X        READBIT(1, b);
  888. X        cur = (b ? nodes[cur].right : left);
  889. X    }
  890. X}
  891. X
  892. X#endif
  893. X
  894. X/* ----------------------------------------------------------- */
  895. X
  896. Xvoid         unImplode()
  897. X     /* expand imploded data */
  898. X{
  899. X   register int srcix;
  900. X   register int Length;
  901. X   register int limit;
  902. X   int          lout;
  903. X   int          Distance;
  904. X
  905. X   LoadTrees();
  906. X
  907. X#ifdef DEBUG
  908. X   printf("\n");
  909. X#endif
  910. X   while ((!zipeof) && ((outpos+outcnt) < ucsize)) {
  911. X      READBIT(1,lout);
  912. X
  913. X      if (lout != 0) {   /* encoded data is literal data */
  914. X         if (lit_tree_present)  /* use Literal Shannon-Fano tree */  {
  915. X            ReadTree(lit_nodes,&lout);
  916. X#ifdef DEBUG
  917. X            printf("lit=%d\n", lout);
  918. X#endif
  919. X         }
  920. X         else
  921. X            READBIT(8,lout);
  922. X
  923. X         OUTB(lout);
  924. X      }
  925. X      else {            /* encoded data is sliding dictionary match */
  926. X         READBIT(dict_bits,Distance);
  927. X
  928. X         ReadTree(distance_nodes,&lout);
  929. X#ifdef DEBUG
  930. X     printf("d=%5d (%2d,%3d)", (lout << dict_bits) | Distance, lout,
  931. X            Distance);
  932. X#endif
  933. X         Distance |= (lout << dict_bits);
  934. X         /* using the Distance Shannon-Fano tree, read and decode the
  935. X            upper 6 bits of the Distance value */
  936. X
  937. X         ReadTree(length_nodes,&lout);
  938. X         Length = lout;
  939. X#ifdef DEBUG
  940. X     printf("\tl=%3d\n", Length);
  941. X#endif
  942. X         /* using the Length Shannon-Fano tree, read and decode the
  943. X            Length value */
  944. X
  945. X         if (Length == 63) {
  946. X            READBIT(8,lout);
  947. X            Length += lout;
  948. X         }
  949. X         Length += minimum_match_length;
  950. X
  951. X        /* move backwards Distance+1 bytes in the output stream, and copy
  952. X          Length characters from this position to the output stream.
  953. X          (if this position is before the start of the output stream,
  954. X          then assume that all the data before the start of the output
  955. X          stream is filled with zeros.  Requires initializing outbuf
  956. X          for each file.) */
  957. X
  958. X        srcix = (outcnt - (Distance + 1)) & (OUTBUFSIZ-1);
  959. X        limit = OUTBUFSIZ - Length;
  960. X        if ((srcix <= limit) && (outcnt < limit))  {
  961. X            zmemcpy(outptr, &outbuf[srcix], Length);
  962. X            outptr += Length;
  963. X            outcnt += Length;
  964. X        }
  965. X        else {
  966. X            while (Length--)  {
  967. X                OUTB(outbuf[srcix++]);
  968. X                srcix &= OUTBUFSIZ-1;
  969. X            }
  970. X        }
  971. X      }
  972. X   }
  973. X}
  974. X
  975. END_OF_FILE
  976. if test 8228 -ne `wc -c <'unimplod.c'`; then
  977.     echo shar: \"'unimplod.c'\" unpacked with wrong size!
  978. fi
  979. # end of 'unimplod.c'
  980. fi
  981. if test -f 'unzip.h' -a "${1}" != "-c" ; then 
  982.   echo shar: Will not clobber existing file \"'unzip.h'\"
  983. else
  984. echo shar: Extracting \"'unzip.h'\" \(10690 characters\)
  985. sed "s/^X//" >'unzip.h' <<'END_OF_FILE'
  986. X/*
  987. X * unzip.c was getting TOO big, so I split out a bunch of likely
  988. X * defines and constants into a separate file.
  989. X * David Kirschbaum
  990. X * Toad Hall
  991. X */
  992. X
  993. X#define VERSION  "UnZip:  Zipfile Extract v3.10 (C) of 08-16-90;  (C) 1989 Samuel H. Smith"
  994. X
  995. X/* #define NOSKIP 1 */    /* v3.04 Enable if you do NOT want
  996. X             * skip_to_signature() enabled */
  997. X
  998. Xtypedef unsigned char byte; /* code assumes UNSIGNED bytes */
  999. Xtypedef long longint;
  1000. Xtypedef unsigned short UWORD;
  1001. Xtypedef char boolean;
  1002. X
  1003. X/* v2.0g Allan Bjorklund added this.  Confirm it doesn't make your system
  1004. X * choke and die!  (Could be it belongs down in the !__STDC__ section
  1005. X * along with *malloc()
  1006. X */
  1007. X#ifdef MTS        /* v2.0h No one else seems to want it tho... */
  1008. X#include <sys/file.h>   /* v2.0g Chitra says MTS needs this for O_BINARY */
  1009. X#endif
  1010. X
  1011. X#define STRSIZ 256
  1012. X
  1013. X#include <stdio.h>
  1014. X /* this is your standard header for all C compiles */
  1015. X#include <ctype.h>
  1016. X
  1017. X#ifdef __TURBOC__           /* v2.0b */
  1018. X#include <timeb.h>      /* for structure ftime */
  1019. X#include <io.h>         /* for setftime(), dup(), creat() */
  1020. X#include <mem.h>        /* for memcpy() */
  1021. X#include <stat.h>       /* for S_IWRITE, S_IREAD */
  1022. X#endif
  1023. X
  1024. X#ifdef __STDC__
  1025. X
  1026. X#include <stdlib.h>
  1027. X /* this include defines various standard library prototypes */
  1028. X
  1029. X#else
  1030. X
  1031. Xchar *malloc();         /* who knows WHERE this is prototyped... */
  1032. X
  1033. X#endif
  1034. X
  1035. X#define min(a,b) ((a) < (b) ? (a) : (b))
  1036. X
  1037. X#ifndef ZMEM                            /* v2.0f use your system's stuff */
  1038. X#define zmemcpy memcpy
  1039. X#define zmemset memset
  1040. X#endif
  1041. X
  1042. X/* ----------------------------------------------------------- */
  1043. X/*
  1044. X * Zipfile layout declarations
  1045. X *
  1046. X */
  1047. X
  1048. X/* Macros for accessing the longint header fields.  These fields
  1049. X   are defined as array of char to prevent a 32-bit compiler from
  1050. X   padding the struct so that longints start on a 4-byte boundary.
  1051. X   This will not work on a machine that can access longints only
  1052. X   if they start on a 4-byte boundary.
  1053. X*/
  1054. X
  1055. X#ifndef NOTINT16    /* v2.0c */
  1056. X#define LONGIP(l) ((longint *) &((l)[0]))
  1057. X#define LONGI(l) (*(LONGIP(l)))
  1058. X#else       /* Have to define, since used for HIGH_LOW */
  1059. X#define LONGIP(I) &I
  1060. X#define LONGI(I) I
  1061. X#endif
  1062. X
  1063. Xtypedef longint signature_type;
  1064. X
  1065. X#define LOCAL_FILE_HEADER_SIGNATURE  0x04034b50L
  1066. X
  1067. X#ifndef NOTINT16            /* v2.0c */
  1068. Xtypedef struct local_file_header {
  1069. X    UWORD version_needed_to_extract;
  1070. X    UWORD general_purpose_bit_flag;
  1071. X    UWORD compression_method;
  1072. X    UWORD last_mod_file_time;
  1073. X    UWORD last_mod_file_date;
  1074. X    byte crc32[4];
  1075. X    byte compressed_size[4];
  1076. X    byte uncompressed_size[4];
  1077. X    UWORD filename_length;
  1078. X    UWORD extra_field_length;
  1079. X} local_file_header;
  1080. X
  1081. X#else   /* NOTINT16 */
  1082. Xtypedef struct local_file_header {
  1083. X    UWORD version_needed_to_extract;
  1084. X    UWORD general_purpose_bit_flag;
  1085. X    UWORD compression_method;
  1086. X    UWORD last_mod_file_time;
  1087. X    UWORD last_mod_file_date;
  1088. X    longint crc32;              /* v2.0e */
  1089. X    longint compressed_size;
  1090. X    longint uncompressed_size;  /* v2.0e */
  1091. X    UWORD filename_length;
  1092. X    UWORD extra_field_length;
  1093. X} local_file_header;
  1094. X
  1095. Xtypedef struct local_byte_header {
  1096. X    byte version_needed_to_extract[2];
  1097. X    byte general_purpose_bit_flag[2];
  1098. X    byte compression_method[2];
  1099. X    byte last_mod_file_time[2];
  1100. X    byte last_mod_file_date[2];
  1101. X    byte crc32[4];
  1102. X    byte compressed_size[4];
  1103. X    byte uncompressed_size[4];
  1104. X    byte filename_length[2];
  1105. X    byte extra_field_length[2];
  1106. X} local_byte_header;
  1107. X#endif
  1108. X
  1109. X#define CENTRAL_FILE_HEADER_SIGNATURE  0x02014b50L
  1110. X
  1111. X#ifndef NOTINT16            /* v2.0c */
  1112. Xtypedef struct central_directory_file_header {
  1113. X    UWORD version_made_by;
  1114. X    UWORD version_needed_to_extract;
  1115. X    UWORD general_purpose_bit_flag;
  1116. X    UWORD compression_method;
  1117. X    UWORD last_mod_file_time;
  1118. X    UWORD last_mod_file_date;
  1119. X    byte crc32[4];
  1120. X    byte compressed_size[4];
  1121. X    byte uncompressed_size[4];
  1122. X    UWORD filename_length;
  1123. X    UWORD extra_field_length;
  1124. X    UWORD file_comment_length;
  1125. X    UWORD disk_number_start;
  1126. X    UWORD internal_file_attributes;
  1127. X    byte external_file_attributes[4];
  1128. X    byte relative_offset_local_header[4];
  1129. X} central_directory_file_header;
  1130. X
  1131. X#else   /* NOTINT16 */
  1132. Xtypedef struct central_directory_file_header {
  1133. X    UWORD version_made_by;
  1134. X    UWORD version_needed_to_extract;
  1135. X    UWORD general_purpose_bit_flag;
  1136. X    UWORD compression_method;
  1137. X    UWORD last_mod_file_time;
  1138. X    UWORD last_mod_file_date;
  1139. X    longint crc32;                  /* v2.0e */
  1140. X    longint compressed_size;        /* v2.0e */
  1141. X    longint uncompressed_size;      /* v2.0e */
  1142. X    UWORD filename_length;
  1143. X    UWORD extra_field_length;
  1144. X    UWORD file_comment_length;
  1145. X    UWORD disk_number_start;
  1146. X    UWORD internal_file_attributes;
  1147. X    longint external_file_attributes;       /* v2.0e */
  1148. X    longint relative_offset_local_header;   /* v2.0e */
  1149. X} central_directory_file_header;
  1150. X
  1151. Xtypedef struct central_directory_byte_header {
  1152. X    byte version_made_by[2];
  1153. X    byte version_needed_to_extract[2];
  1154. X    byte general_purpose_bit_flag[2];
  1155. X    byte compression_method[2];
  1156. X    byte last_mod_file_time[2];
  1157. X    byte last_mod_file_date[2];
  1158. X    byte crc32[4];
  1159. X    byte compressed_size[4];
  1160. X    byte uncompressed_size[4];
  1161. X    byte filename_length[2];
  1162. X    byte extra_field_length[2];
  1163. X    byte file_comment_length[2];
  1164. X    byte disk_number_start[2];
  1165. X    byte internal_file_attributes[2];
  1166. X    byte external_file_attributes[4];
  1167. X    byte relative_offset_local_header[4];
  1168. X} central_directory_byte_header;
  1169. X#endif
  1170. X
  1171. X#define END_CENTRAL_DIR_SIGNATURE  0x06054b50L
  1172. X
  1173. X#ifndef NOTINT16            /* v2.0c */
  1174. Xtypedef struct end_central_dir_record {
  1175. X    UWORD number_this_disk;
  1176. X    UWORD number_disk_with_start_central_directory;
  1177. X    UWORD total_entries_central_dir_on_this_disk;
  1178. X    UWORD total_entries_central_dir;
  1179. X    byte size_central_directory[4];
  1180. X    byte offset_start_central_directory[4];
  1181. X    UWORD zipfile_comment_length;
  1182. X} end_central_dir_record;
  1183. X
  1184. X#else   /* NOTINT16 */
  1185. Xtypedef struct end_central_dir_record {
  1186. X    UWORD number_this_disk;
  1187. X    UWORD number_disk_with_start_central_directory;
  1188. X    UWORD total_entries_central_dir_on_this_disk;
  1189. X    UWORD total_entries_central_dir;
  1190. X    longint size_central_directory;         /* v2.0e */
  1191. X    longint offset_start_central_directory; /* v2.0e */
  1192. X    UWORD zipfile_comment_length;
  1193. X} end_central_dir_record;
  1194. X
  1195. Xtypedef struct end_central_byte_record {
  1196. X    byte number_this_disk[2];
  1197. X    byte number_disk_with_start_central_directory[2];
  1198. X    byte total_entries_central_dir_on_this_disk[2];
  1199. X    byte total_entries_central_dir[2];
  1200. X    byte size_central_directory[4];
  1201. X    byte offset_start_central_directory[4];
  1202. X    byte zipfile_comment_length[2];
  1203. X} end_central_byte_record;
  1204. X#endif  /* NOTINT16 */
  1205. X
  1206. X#define DLE 144
  1207. X
  1208. X#define max_bits 13
  1209. X#define init_bits 9
  1210. X#define hsize 8192
  1211. X#define first_ent 257
  1212. X#define clear 256
  1213. X
  1214. X/* ============================================================= */
  1215. X/*
  1216. X * Host operating system details
  1217. X *
  1218. X */
  1219. X
  1220. X#ifdef UNIX
  1221. X
  1222. X/* On some systems the contents of sys/param.h duplicates the
  1223. X   contents of sys/types.h, so you don't need (and can't use)
  1224. X   sys/types.h. */
  1225. X
  1226. X#include <sys/types.h>
  1227. X#include <sys/param.h>
  1228. X
  1229. X#define ZSUFX ".zip"
  1230. X#ifndef BSIZE
  1231. X#define BSIZE DEV_BSIZE     /* v2.0c assume common for all Unix systems */
  1232. X#endif
  1233. X
  1234. X#ifndef BSD                 /* v2.0b */
  1235. X#include <time.h>
  1236. Xstruct tm *gmtime(), *localtime();
  1237. X#else   /* BSD */
  1238. X#include <sys/time.h>
  1239. X#endif
  1240. X
  1241. X#else   /* !UNIX */
  1242. X
  1243. X#define BSIZE 512   /* disk block size */
  1244. X#define ZSUFX ".ZIP"
  1245. X
  1246. X#endif
  1247. X
  1248. X#if defined(V7) || defined(BSD)
  1249. X
  1250. X#define strchr index
  1251. X#define strrchr rindex
  1252. X
  1253. X#endif
  1254. X
  1255. X/*  v3.03 Everybody seems to need this.
  1256. X * this include file defines
  1257. X *             #define S_IREAD 0x0100  (* owner may read *)
  1258. X *             #define S_IWRITE 0x0080 (* owner may write *)
  1259. X * as used in the creat() standard function
  1260. X */
  1261. X#ifndef __TURBOC__    /* it's already included */
  1262. X#include <sys/stat.h>    /* for S_IWRITE, S_IREAD  v3.03 */
  1263. X#endif
  1264. X
  1265. X#ifdef __STDC__
  1266. X
  1267. X#include <string.h>
  1268. X /* this include defines strcpy, strcmp, etc. */
  1269. X
  1270. X#else
  1271. X
  1272. Xchar *strchr(), *strrchr();
  1273. X
  1274. X#endif
  1275. X
  1276. Xlong lseek();
  1277. X
  1278. X#define SEEK_SET  0
  1279. X#define SEEK_CUR  1
  1280. X#define SEEK_END  2
  1281. X
  1282. X#ifdef V7
  1283. X
  1284. X#define O_RDONLY  0
  1285. X#define O_WRONLY  1
  1286. X#define O_RDWR    2
  1287. X
  1288. X#else   /* !V7 */
  1289. X
  1290. X#include <fcntl.h>
  1291. X /*
  1292. X  * this include file defines
  1293. X  *             #define O_BINARY 0x8000  (* no cr-lf translation *)
  1294. X  * as used in the open() standard function
  1295. X  */
  1296. X
  1297. X#endif  /* V7 */
  1298. X
  1299. X#ifdef __TURBOC__
  1300. X/* v2.0b Local Prototypes */
  1301. X    /* In CRC32.C */
  1302. Xextern void UpdateCRC(register unsigned char *s, register int len);
  1303. X    /* In MATCH.C */
  1304. Xextern int match(char *string, char *pattern);
  1305. X    /* v2.0j in mapname.c */
  1306. Xextern int mapped_name(void);
  1307. X
  1308. X#ifdef NOTINT16         /* v2.0c */
  1309. X/* The next two are only prototyped here for debug testing on my PC
  1310. X * with Turbo C.
  1311. X */
  1312. X
  1313. XUWORD makeword(byte *b);
  1314. Xlongint makelong(byte *sig);    /* v2.0e */
  1315. X#endif  /* NOTINT16 */
  1316. X
  1317. Xint ReadByte(UWORD *x);
  1318. Xint FillBitBuffer(register int bits);
  1319. Xvoid LoadFollowers(void);
  1320. Xvoid FlushOutput(void);
  1321. Xvoid partial_clear(void);
  1322. Xint create_output_file(void);
  1323. Xvoid unShrink(void);
  1324. Xvoid unReduce(void);
  1325. Xvoid unImplode(void);
  1326. Xvoid set_file_time(void);
  1327. Xint readbuf(int fd, char *buf, register unsigned size);
  1328. Xvoid get_string(int len, char *s);
  1329. Xvoid dir_member(void);
  1330. Xvoid extract_member(void);
  1331. Xvoid skip_member(void);
  1332. Xvoid process_local_file_header(char **fnamev);
  1333. Xvoid process_central_file_header(void);
  1334. Xvoid process_end_central_dir(void);
  1335. Xint open_input_file(void);
  1336. Xvoid process_headers(void);
  1337. Xvoid usage(void);
  1338. Xvoid process_zipfile(void);
  1339. X#endif  /* __TURBOC__ */
  1340. X
  1341. X/* ------------------------------------------------------------- */
  1342. X
  1343. X/* v3.05 Deleting  crc32.h and incorporating its two lines right here */
  1344. X/* #include "crc32.h" */
  1345. X
  1346. Xunsigned long crc32val;
  1347. X#ifndef __TURBOC__    /* it's already been prototyped above */
  1348. Xvoid UpdateCRC();
  1349. X#endif
  1350. X
  1351. X#define LF 10        /* '\n' on ascii machines.  Must be 10 due to EBCDIC */
  1352. X#define CR 13        /* '\r' on ascii machines.  Must be 13 due to EBCDIC */
  1353. X
  1354. X#ifdef EBCDIC
  1355. Xextern unsigned char ebcdic [];
  1356. X#define ascii_to_native(c) ebcdic[(c)]
  1357. X#else
  1358. X#define ascii_to_native(c) (c)
  1359. X#endif
  1360. X
  1361. X#define OUTB(intc) { *outptr++=intc; if (++outcnt==OUTBUFSIZ) FlushOutput(); }
  1362. X
  1363. X/*
  1364. X *  macro OUTB(intc)
  1365. X *  {
  1366. X *      *outptr++=intc;
  1367. X *      if (++outcnt==OUTBUFSIZ)
  1368. X *          FlushOutput();
  1369. X *  }
  1370. X *
  1371. X */
  1372. X
  1373. X#define READBIT(nbits,zdest) { if (nbits <= bits_left) { zdest = (int)(bitbuf & mask_bits[nbits]); bitbuf >>= nbits; bits_left -= nbits; } else zdest = FillBitBuffer(nbits);}
  1374. X
  1375. X/*
  1376. X * macro READBIT(nbits,zdest)
  1377. X *  {
  1378. X *      if (nbits <= bits_left) {
  1379. X *          zdest = (int)(bitbuf & mask_bits[nbits]);
  1380. X *          bitbuf >>= nbits;
  1381. X *          bits_left -= nbits;
  1382. X *      } else
  1383. X *          zdest = FillBitBuffer(nbits);
  1384. X *  }
  1385. X *
  1386. X */
  1387. END_OF_FILE
  1388. if test 10690 -ne `wc -c <'unzip.h'`; then
  1389.     echo shar: \"'unzip.h'\" unpacked with wrong size!
  1390. fi
  1391. # end of 'unzip.h'
  1392. fi
  1393. if test -f 'unzip.os2' -a "${1}" != "-c" ; then 
  1394.   echo shar: Will not clobber existing file \"'unzip.os2'\"
  1395. else
  1396. echo shar: Extracting \"'unzip.os2'\" \(9658 characters\)
  1397. sed "s/^X//" >'unzip.os2' <<'END_OF_FILE'
  1398. X[These patches have NOT been installed as of v3.10.
  1399. X David Kirschbaum
  1400. X Info-ZIP Coordinator
  1401. X]
  1402. X
  1403. XReceived: by mcsun.EU.net via EUnet; Fri, 18 May 90 20:50:40 +0200 (MET)
  1404. XReceived: from lena by kestrel.Ukc.AC.UK   with UUCP  id aa00758;
  1405. X          18 May 90 18:19 BST
  1406. XReceived: by lena with netmail(8.73); Fri May 18 14:30:13 BST 1990
  1407. XDate: Fri May 18 14:30:13 BST 1990
  1408. XX-Mailer: Mail User's Shell (7.0.4 1/26/90)
  1409. XFrom: Mike O'Carroll <mike@elec-eng.leeds.ac.uk>
  1410. XMessage-Id: <4867.9005181430.lena@lena.uucp>
  1411. XTo: kirsch@usasoc.soc.mil
  1412. XSubject: unzip30
  1413. X
  1414. XI'm not sure if anyone else has done this, but I have made a Dos & OS/2
  1415. Xversion of unzip.  The cdiffs are below.  The supplied makefile (unzip)
  1416. Xgenerates a family program which executes in both Dos and OS/2 modes.
  1417. XI can supply the .exe if required (31K).
  1418. X
  1419. XThe mods took 15 minutes, and the result has undergone 35 seconds
  1420. Xtesting (:-) ; I had one .ZIP file to unzip, and it worked OK, but no
  1421. Xgreat confidence yet.
  1422. X
  1423. XBTW, can I get a corresponding ZIP from somewhere?  Simtel20?
  1424. X
  1425. XRegards,
  1426. X        Mike
  1427. X
  1428. X-------------------------
  1429. X#       This is a shell archive.
  1430. X#       Remove everything above and including the cut line.
  1431. X#       Then run the rest of the file through sh.
  1432. X#-----cut here-----cut here-----cut here-----cut here-----
  1433. X#!/bin/sh
  1434. X# shar: Shell Archiver
  1435. X#       Run the following text with /bin/sh to create:
  1436. X#       match.dif
  1437. X#       unzip.dif
  1438. X#       unzip
  1439. X# This archive created: Fri May 18 14:20:18 BST 1990
  1440. Xif [ -f 'match.dif' ] ; then
  1441. Xecho shar: will not overwrite existing file \'match.dif\' >&2
  1442. Xelse
  1443. Xcat << \SHAR_EOF >'match.dif'
  1444. X*** match.c     Fri May 18 13:54:07 1990
  1445. X--- Dmatch.c    Fri May 18 13:54:15 1990
  1446. X***************
  1447. X*** 10,15
  1448. X   * 11/13/89  C. Mascott     adapt for use with unzip
  1449. X   * 01/25/90  J. Cowan       match case-insensitive
  1450. X   * 03/17/90  D. Kirschbaum      Prototypes, other tweaks for Turbo C.
  1451. X   *
  1452. X   */
  1453. X  
  1454. X
  1455. X--- 10,16 -----
  1456. X   * 11/13/89  C. Mascott     adapt for use with unzip
  1457. X   * 01/25/90  J. Cowan       match case-insensitive
  1458. X   * 03/17/90  D. Kirschbaum      Prototypes, other tweaks for Turbo C.
  1459. X+  * 18-may-90 M. O'Carroll   Dos & OS/2 family version
  1460. X   *
  1461. X   */
  1462. X  
  1463. X***************
  1464. X*** 24,29
  1465. X   *        This file contains service routines needed to maintain an archive.
  1466. X   */
  1467. X  
  1468. X  #include <sys/types.h>
  1469. X  #include <sys/dir.h>
  1470. X  #include <ctype.h>
  1471. X
  1472. X--- 25,31 -----
  1473. X   *        This file contains service routines needed to maintain an archive.
  1474. X   */
  1475. X  
  1476. X+ #ifdef MSC
  1477. X  #include <sys/types.h>
  1478. X  #include <ctype.h>
  1479. X  #include <stdio.h>
  1480. X***************
  1481. X*** 25,30
  1482. X   */
  1483. X  
  1484. X  #include <sys/types.h>
  1485. X  #include <sys/dir.h>
  1486. X  #include <ctype.h>
  1487. X  
  1488. X
  1489. X--- 27,36 -----
  1490. X  
  1491. X  #ifdef MSC
  1492. X  #include <sys/types.h>
  1493. X+ #include <ctype.h>
  1494. X+ #include <stdio.h>
  1495. X+ #else
  1496. X+ #include <sys/types.h>
  1497. X  #include <sys/dir.h>
  1498. X  #include <ctype.h>
  1499. X  #endif
  1500. X***************
  1501. X*** 27,32
  1502. X  #include <sys/types.h>
  1503. X  #include <sys/dir.h>
  1504. X  #include <ctype.h>
  1505. X  
  1506. X  #ifdef __TURBOC__               /* v2.0b */
  1507. X  #include <stdio.h>      /* for printf() */
  1508. X
  1509. X--- 33,39 -----
  1510. X  #include <sys/types.h>
  1511. X  #include <sys/dir.h>
  1512. X  #include <ctype.h>
  1513. X+ #endif
  1514. X  
  1515. X  #ifdef __TURBOC__               /* v2.0b */
  1516. X  #include <stdio.h>      /* for printf() */
  1517. XSHAR_EOF
  1518. Xfi
  1519. Xif [ -f 'unzip.dif' ] ; then
  1520. Xecho shar: will not overwrite existing file \'unzip.dif\' >&2
  1521. Xelse
  1522. Xcat << \SHAR_EOF >'unzip.dif'
  1523. X*** unzip.c     Fri May 18 13:52:51 1990
  1524. X--- Dunzip.c    Fri May 18 13:53:00 1990
  1525. X***************
  1526. X*** 63,68
  1527. X  
  1528. X  #endif
  1529. X  
  1530. X  #define min(a,b) ((a) < (b) ? (a) : (b))
  1531. X  
  1532. X  #ifndef ZMEM                            /* v2.0f use your system's stuff */
  1533. X
  1534. X--- 63,77 -----
  1535. X  
  1536. X  #endif
  1537. X  
  1538. X+ /* Added stuff for MSC Dos & OS/2 family version - Mike O'Carroll, 18-May-90
  1539. X+  */
  1540. X+ #ifdef MSC
  1541. X+ #include <os2.h>
  1542. X+ #include <sys/types.h>
  1543. X+ #include <io.h>         /* for setftime(), dup(), creat() */
  1544. X+ #include <sys/stat.h>   /* for S_IWRITE, S_IREAD */
  1545. X+ #include <memory.h>     /* for memcpy() */
  1546. X+ #else
  1547. X  #define min(a,b) ((a) < (b) ? (a) : (b))
  1548. X  #endif /* MSC */
  1549. X  
  1550. X***************
  1551. X*** 64,69
  1552. X  #endif
  1553. X  
  1554. X  #define min(a,b) ((a) < (b) ? (a) : (b))
  1555. X  
  1556. X  #ifndef ZMEM                            /* v2.0f use your system's stuff */
  1557. X  #define zmemcpy memcpy
  1558. X
  1559. X--- 73,79 -----
  1560. X  #include <memory.h>     /* for memcpy() */
  1561. X  #else
  1562. X  #define min(a,b) ((a) < (b) ? (a) : (b))
  1563. X+ #endif /* MSC */
  1564. X  
  1565. X  #ifndef ZMEM                            /* v2.0f use your system's stuff */
  1566. X  #define zmemcpy memcpy
  1567. X***************
  1568. X*** 473,478
  1569. X    */
  1570. X  {
  1571. X  #ifndef UNIX
  1572. X      union {
  1573. X          struct ftime ft;        /* system file time record */
  1574. X          struct {
  1575. X
  1576. X--- 483,489 -----
  1577. X    */
  1578. X  {
  1579. X  #ifndef UNIX
  1580. X+ #   ifdef MSC
  1581. X      union {
  1582. X          FDATE fd;               /* system file date record */
  1583. X          UWORD zdate;            /* date word */
  1584. X***************
  1585. X*** 474,479
  1586. X  {
  1587. X  #ifndef UNIX
  1588. X      union {
  1589. X          struct ftime ft;        /* system file time record */
  1590. X          struct {
  1591. X                  UWORD ztime;     /* date and time words */
  1592. X
  1593. X--- 485,511 -----
  1594. X  #ifndef UNIX
  1595. X  #   ifdef MSC
  1596. X      union {
  1597. X+         FDATE fd;               /* system file date record */
  1598. X+         UWORD zdate;            /* date word */
  1599. X+     } ud;
  1600. X+ 
  1601. X+     union {
  1602. X+         FTIME ft;               /* system file time record */
  1603. X+         UWORD ztime;            /* time word */
  1604. X+     } ut;
  1605. X+ 
  1606. X+     FILESTATUS fs;
  1607. X+ 
  1608. X+     DosQFileInfo(outfd, 1, &fs, sizeof(fs));
  1609. X+     ud.zdate = lrec.last_mod_file_date;
  1610. X+     fs.fdateLastWrite = ud.fd;
  1611. X+     ut.ztime = lrec.last_mod_file_time;
  1612. X+     fs.ftimeLastWrite = ut.ft;
  1613. X+     DosSetFileInfo(outfd, 1, &fs, sizeof(fs));
  1614. X+ 
  1615. X+ #   else /* MSC */
  1616. X+ 
  1617. X+     union {
  1618. X          struct ftime ft;        /* system file time record */
  1619. X          struct {
  1620. X                  UWORD ztime;     /* date and time words */
  1621. X***************
  1622. X*** 490,495
  1623. X      td.zt.zdate = lrec.last_mod_file_date;
  1624. X  
  1625. X      setftime(outfd, &td.ft);
  1626. X  
  1627. X  #else   /* UNIX */
  1628. X  
  1629. X
  1630. X--- 522,529 -----
  1631. X      td.zt.zdate = lrec.last_mod_file_date;
  1632. X  
  1633. X      setftime(outfd, &td.ft);
  1634. X+ 
  1635. X+ #   endif /* MSC */
  1636. X  
  1637. X  #else   /* UNIX */
  1638. X  
  1639. XSHAR_EOF
  1640. Xfi
  1641. Xif [ -f 'unzip' ] ; then
  1642. Xecho shar: will not overwrite existing file \'unzip\' >&2
  1643. Xelse
  1644. Xcat << \SHAR_EOF >'unzip'
  1645. X# For MSC brian damaged (:-) make.  To generate Dos & OS/2 version, type
  1646. X# "make unzip"
  1647. X#
  1648. X# I used Microsoft C V5.1, with the SDK.
  1649. X#
  1650. X# The following comments come from the Unix Makefile, and most may
  1651. X# well be irrelevant to the Dos version.
  1652. X#       Mike O'Carroll 18-May-90 <mike@ee.leeds.ac.uk>
  1653. X# -----------------------------------------------------------------------
  1654. X#
  1655. X# "make vaxbsd" -- makes unzip on a VAX 11-780 BSD 4.3 in current directory
  1656. X# "make"        -- uses environment variable SYSTEM to set the type
  1657. X#                  system to compile for.
  1658. X# "make wombat" -- Chokes and dies if you haven't added the specifics
  1659. X#                  for your Wombat 68000 (or whatever) to the systems list.
  1660. X#
  1661. X# CFLAGS are flags for the C compiler.  LDFLAGS are flags for the loader.
  1662. X#
  1663. X# My host (a VAX 11-780 running BSD 4.3) is hereafter referred to as
  1664. X# "my host."
  1665. X#
  1666. X# My host's /usr/include/sys/param.h defines BSD for me.
  1667. X# You may have to add "-DBSD" to the list of CFLAGS for your system.
  1668. X#
  1669. X# You MAY need to define "-DNOTINT16" if the program produces crc errors
  1670. X# during a "-t" run or extraction.  (This involves structure alignment.)
  1671. X# It won't HURT to define "-dNOTINT16" anyway .. but if you don't need it,
  1672. X# why add to the program size, complexity, etc.?
  1673. X#
  1674. X# If your host is "big-endian" (as in the 68000 family) and does NOT order
  1675. X# its integers and long integers in Intel fashion (low .. high), you should
  1676. X# define "-DHIGH_LOW".  This insures key structure values will be "swapped"
  1677. X# low end for high end.
  1678. X# Some mainframes DO require this.
  1679. X#
  1680. X# Some systems have a shell-defined "$MAKE" (my host did not).  If not,
  1681. X# use "make" instead of the "$MAKE" or "$(MAKE)" in your system's makerule.
  1682. X# Or try adding the following line to your .login file:
  1683. X#   setenv MAKE "make"
  1684. X# (It didn't help on my host.)
  1685. X#
  1686. X# zmemcpy has been added to the list of required files for some systems.
  1687. X# memcpy() is a normal C function that works just fine in Turbo C
  1688. X# and some Unix systems, but has a problem in others (producing CRC errors).
  1689. X#
  1690. X# You can try a compile without zmemcpy.c, and if it works .. fine.
  1691. X# (To do this, you may have to remove zmemcpy.o from your system's list
  1692. X# of required OBJS files, and the "-DZMEM" from the list of CFLAGS defines.)
  1693. X#
  1694. X# Else use the included zmemcpy.c.
  1695. X# (Again, you may have to add zmemcpy.o to your system's list of required
  1696. X# OBJS files, and the "-DZMEM" to the list of CFLAGS defines.)
  1697. X
  1698. X# To test, insure your zip file includes some LARGE members.  Many systems
  1699. X# ran just fine with zip file members <512 bytes, but failed with larger ones.
  1700. X#
  1701. X
  1702. XCC = cl
  1703. XCFLAGS = -DMSC
  1704. XLD = link
  1705. XLDFLAGS = /NOI
  1706. XRM = del
  1707. XLIBC = c:\m5\lib\p\slibce
  1708. XLIBD = c:\m5\lib\doscalls.lib
  1709. XLIBA = c:\m5\lib\api.lib
  1710. XINCL = -Ic:\m5\include
  1711. X
  1712. XOBJ1 = unzip.obj crc32.obj match.obj ascebc.obj mapname.obj
  1713. XOBJ2 = zmemset.obj zmemcpy.obj
  1714. X
  1715. X.c.obj:
  1716. X        $(CC) -c $(CFLAGS) $(INCL) $*.c
  1717. X
  1718. Xunzip.obj:      unzip.c
  1719. X
  1720. Xcrc32.obj:      crc32.c
  1721. X
  1722. Xmatch.obj:      match.c
  1723. X
  1724. Xascebc.obj:     ascebc.c
  1725. X
  1726. Xmapname.obj:    mapname.c
  1727. X
  1728. Xzmemset.obj:    zmemset.c
  1729. X
  1730. Xzmemcpy.obj:    zmemcpy.c
  1731. X
  1732. Xunziptmp.exe:   $(OBJ1) $(OBJ2)
  1733. X        $(LD) $(LDFLAGS) $(OBJ1) $(OBJ2), $*.exe,,$(LIBC)+$(LIBD);
  1734. X
  1735. Xunzip.exe:      unziptmp.exe
  1736. X        bind unziptmp.exe $(LIBD) $(LIBA) -o unzip.exe
  1737. X        $(RM) unziptmp.exe
  1738. X        $(RM) *.obj
  1739. X        $(RM) *.map
  1740. XSHAR_EOF
  1741. Xfi
  1742. X
  1743. X-- 
  1744. XMike O'Carroll, Microsystems Unit, University of Leeds, LS2 9JT, UK
  1745. XE-mail: @ukc.ac.uk:mike@ee.leeds.ac.uk
  1746. XUUCP:   ...!mcsun!ukc!lena!mike or mike@lena.uucp
  1747. END_OF_FILE
  1748. if test 9658 -ne `wc -c <'unzip.os2'`; then
  1749.     echo shar: \"'unzip.os2'\" unpacked with wrong size!
  1750. fi
  1751. # end of 'unzip.os2'
  1752. fi
  1753. echo shar: End of archive 2 \(of 3\).
  1754. cp /dev/null ark2isdone
  1755. MISSING=""
  1756. for I in 1 2 3 ; do
  1757.     if test ! -f ark${I}isdone ; then
  1758.     MISSING="${MISSING} ${I}"
  1759.     fi
  1760. done
  1761. if test "${MISSING}" = "" ; then
  1762.     echo You have unpacked all 3 archives.
  1763.     rm -f ark[1-9]isdone
  1764. else
  1765.     echo You still need to unpack the following archives:
  1766.     echo "        " ${MISSING}
  1767. fi
  1768. ##  End of shell archive.
  1769. exit 0
  1770.